import jwt
from management.models import user
from django.conf import settings


def usertype(request):
    token = request.META.get('HTTP_AUTHORIZATION')
    salt = settings.SECRET_KEY
    payload = jwt.decode(token, salt, True)
    type = user.objects.get(id=payload['id']).type
    return type